package cn.iot.controller.sys;

import cn.iot.common.dto.ResultMsg;
import cn.iot.sys.entity.SysClassroom;
import cn.iot.sys.service.SysClassroomService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/sys/classroom")
public class SysClassroomController {
    @Autowired
    private SysClassroomService sysClassroomService;
    private Logger logger = LoggerFactory.getLogger(getClass());

    @PostMapping("getSysClassroomList")
    public ResultMsg getSysClassroomList(@RequestParam Map<String,Object> map){
        logger.info("SysClassroomController getSysClassroomList map{}",map);
        ResultMsg msg = sysClassroomService.getSysClassroomList(map);
        logger.debug("SysClassroomController getSysClassroomList msg{}",msg);
        return msg;
    }

    @PostMapping("addSysClassroom")
    public ResultMsg addSysClassroom(@RequestBody SysClassroom sysClassroom){
        logger.info("SysClassroomController addSysClassroom sysClassroom{}",sysClassroom);
        ResultMsg msg = sysClassroomService.addSysClassroom(sysClassroom);
        logger.debug("SysClassroomController addSysClassroom msg{}",msg);
        return msg;
    }
    @PostMapping("updSysClassroom")
    public ResultMsg updSysClassroom(@RequestBody SysClassroom sysClassroom){
        logger.info("SysClassroomController updSysClassroom sysClassroom{}",sysClassroom);
        ResultMsg msg = sysClassroomService.updSysClassroom(sysClassroom);
        logger.debug("SysClassroomController addSysClassroom msg{}",msg);
        return msg;
    }
    @PostMapping("delClassroomById")
    public ResultMsg delClassroomById(@RequestParam int id){
        logger.info("SysClassroomController delClassroomById id{}",id);
        ResultMsg msg = sysClassroomService.delClassroomById(id);
        logger.debug("SysClassroomController delClassroomById msg{}",msg);
        return msg;
    }
    @PostMapping("getSysClassroomAll")
    public ResultMsg getSysClassroomAll(){
        logger.info("SysClassroomController getSysClassroomList start ...");
        ResultMsg msg = sysClassroomService.getSysClassroomAll();
        logger.debug("SysClassroomController getSysClassroomList msg{}",msg);
        return msg;
    }
}
